﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OA.Model;
using OA.Utility;
using System.Data;

namespace OA.Bll.Personnel
{
    public class PerformancePresenter : BasePresenter<PerformanceInfo>
    {
        public override string Paged(JsonReq req)
        {
            return Search(req);
        }


        public override string Search(JsonReq req)
        {
            int pageIndex = Convert.ToInt32(req["page"]);
            int pageSize = Convert.ToInt32(req["rows"]);
            int total = 0;
            //T info = JsonHelper.JsonDeserialize<T>(req.Options);
            string sql = JsonHelper.GetQueryFilterString(req.Options);
            //Type type = typeof(PerformanceInfo);
            //if (type.GetProperties().Count(a => a.Name.ToLower() == "createtime") > 0)
            //    sql += " order by [createtime] desc";
            DataTable dt = new Manager.ManagerParent<PerformanceViewInfo>().GetSearchPaged(sql, pageIndex, pageSize, ref total);
            return JsonHelper.OnDataGrid(dt, total);
        }
    }
}
